home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* Main routine *)
- (* *)
- (* Copyright 1988, 1989, 1991 by H. Roy Engehausen. All rights reserved. *)
- (* *)
- (*===========================================================================*)
-
- {$DEFINE DEBUG_MEMLOW}
-
- PROCEDURE main;
-
- VAR
- status_char : CHAR;
- m_time : LONGINT;
- delay_count : BYTE;
- stor_size : WORD;
- t_str : STRING[4];
- tcb_place : tcb_ptr;
-
- BEGIN;
-
- REPEAT
-
- (*---------------------------------------------------------------------*)
- (* Force a switch *)
- (*---------------------------------------------------------------------*)
-
- task_switch;
-
- (*---------------------------------------------------------------------*)
- (* Delete old tcbs *)
- (*---------------------------------------------------------------------*)
-
- WHILE dead_tcb_list <> NIL DO
- BEGIN;
- tcb_place := dead_tcb_list;
- dead_tcb_list := tcb_place^.next_tcb;
- task_free(tcb_place);
- END;
-
- (*---------------------------------------------------------------------*)
- (* Memory check *)
- (*---------------------------------------------------------------------*)
-
- {$IFDEF DEBUG_MEMLOW}
- IF MAXAVAIL < 5000 THEN
- BEGIN;
- WRITELN('Memory low dump');
- dump_all;
- END;
- {$ENDIF}
-
- (*---------------------------------------------------------------------*)
- (* Check the time *)
- (*---------------------------------------------------------------------*)
-
- time_check;
-
- (*---------------------------------------------------------------------*)
- (* If delay then do something *)
- (*---------------------------------------------------------------------*)
-
- IF delay_count > 10 THEN
- BEGIN;
-
- delay_count := 0;
-
- (*-----------------------------------------------------------------*)
- (* Update status line *)
- (*-----------------------------------------------------------------*)
-
- IF status_window_change THEN
- BEGIN;
- stor_size := MEMAVAIL div 1024;
- STR(stor_size, t_str);
-
- status_char := byte_to_char[alive_tcb_count];
-
- window_status_line(status_char + ' '
- + t_str + 'K ' + todays_date_time);
-
- status_window_change := FALSE;
- END;
-
- END;
-
- INC(delay_count);
-
- UNTIL shutdown_switch; (*----- End of main loop -------------------------*)
-
- FOR delay_count := 1 TO 10 DO
- task_switch;
-
- END;